package com.ruyuan.course.basic.biz.controller;

import com.ruyuan.course.basic.biz.common.CommonResponse;
import com.ruyuan.course.basic.biz.domain.Demo;
import com.ruyuan.course.basic.biz.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author demo
 * version: 1.0
 * Description:demo controller组件
 **/
@RestController
@RequestMapping(value = "/demo")
public class DemoController {

    /**
     * service 组件
     */
    @Autowired
    private DemoService demoService;

    /**
     * 根据主键id查询
     *
     * @param id 主键id
     * @return 结果
     */
    @GetMapping(value = "/{id}")
    public CommonResponse<Demo> getById(@PathVariable(value = "id") Integer id) {
        return demoService.getById(id);
    }
}